module TableFor
  module ViewHelper
    def table_for_to_s(table_id,options={},&block)
      data_list = eval("@#{table_id}",block.binding)
      options = {}.merge(Cool::DEFAULT_TABLE_FEATURES).merge(options)
      t = ::Cool::Table.new(self,table_id,data_list,options)    
      yield(t)
      t.render 
    end
    def table_for(table_id, options={}, &block)
      data_list = eval("@#{table_id}", block.binding)
      options = {}.merge(::Cool::DEFAULT_TABLE_FEATURES).merge(options)
      t = ::Cool::Table.new(self, table_id, data_list, options)    
      yield(t)
      s = t.render 
      self.concat(s, block.binding)
    end
  end
end